package comet;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
@Entity
public class Departement implements Serializable {
	@Id
	private String Nom;

	public Departement() {
	}
	public Departement(String nom) {

		this.Nom = nom;
	}

	public String getNom() {
		return this.Nom;
	}
	public void setNom(String nom) {
		this.Nom = nom;
	}

	@OneToMany
	@JoinTable(name = "DEPARTEMENT_ENSEIGNANT", joinColumns = @JoinColumn(name = "DEPARTEMENT_ID"), inverseJoinColumns = @JoinColumn(name = "ENSEIGNANT_ID"))
	private Collection<Enseignant> enseignants = new ArrayList<Enseignant>();

	public void addEnseignant(Enseignant enseignant) {
		if (!getEnseignants().contains(enseignant)) {
			getEnseignants().add(enseignant);
		}
	}

	public Collection<Enseignant> getEnseignants() {
		return enseignants;
	}

}
